#pragma once

#include <boost/noncopyable.hpp>
#include "SceneNode.hpp"

namespace cge {
	class Camera: public Entity {
	public:
		Camera();
		virtual ~Camera();

		void applyView();

		void setFov( double fov );
		void setAspectRatio( double aspectRatio );
		void setZLimits( double zNear, double zFar );
		void setProjection( double fov, double aspectRatio, double zNear, double zFar );

	protected:
		void requireProjectionUpdate();
		void requireModelviewUpdate();

		virtual void updateProjection();
		virtual void updateModelview();

	private:
		// override SceneNodeListener
		void onTransformed();
		void onAttached();

		double fov_, aspect_, znear_, zfar_;
		double proj_[16], model_[16];
		bool needProjUpdate_, needModelUpdate_;
	};
}